<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <link rel="stylesheet" href="../layui/css/layui.css">
  <script src="../layui/layui.js"></script>
  <link rel="stylesheet" href="../css/basic.css">
</head>
<body>
<script>
!function(){function n(n,e,t){return n.getAttribute(e)||t}function e(n){return document.getElementsByTagName(n)}function t(){var t=e("script"),o=t.length,i=t[o-1];return{l:o,z:n(i,"zIndex",-1),o:n(i,"opacity",.9),c:n(i,"color","0,0,0"),n:n(i,"count",99)}}function o(){a=m.width=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,c=m.height=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}function i(){r.clearRect(0,0,a,c);var n,e,t,o,m,l;s.forEach(function(i,x){for(i.x+=i.xa,i.y+=i.ya,i.xa*=i.x>a||i.x<0?-1:1,i.ya*=i.y>c||i.y<0?-1:1,r.fillRect(i.x-.5,i.y-.5,1,1),e=x+1;e<u.length;e++)n=u[e],null!==n.x&&null!==n.y&&(o=i.x-n.x,m=i.y-n.y,l=o*o+m*m,l<n.max&&(n===y&&l>=n.max/2&&(i.x-=.03*o,i.y-=.03*m),t=(n.max-l)/n.max,r.beginPath(),r.lineWidth=t/2,r.strokeStyle="rgba("+d.c+","+(t+.2)+")",r.moveTo(i.x,i.y),r.lineTo(n.x,n.y),r.stroke()))}),x(i)}var a,c,u,m=document.createElement("canvas"),d=t(),l="c_n"+d.l,r=m.getContext("2d"),x=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(n){window.setTimeout(n,1e3/45)},w=Math.random,y={x:null,y:null,max:2e4};m.id=l,m.style.cssText="position:fixed;top:0;left:0;z-index:"+d.z+";opacity:"+d.o,e("body")[0].appendChild(m),o(),window.onresize=o,window.onmousemove=function(n){n=n||window.event,y.x=n.clientX,y.y=n.clientY},window.onmouseout=function(){y.x=null,y.y=null};for(var s=[],f=0;d.n>f;f++){var h=w()*a,g=w()*c,v=2*w()-1,p=2*w()-1;s.push({x:h,y:g,xa:v,ya:p,max:6e3})}u=s.concat([y]),setTimeout(function(){i()},100)}();
</script>
  <div class="layui-container bs-center" >
    <form id="baseInfo" class="layui-form fm-in" lay-filter="">
    	<div class="layui-form-item">
            <label class="layui-form-label"> 标识号：</label>
            <div class="layui-input-block">
                <input type="text" id="soc_mark" required  lay-verify="required" readonly autocomplete="off" class="layui-input">
            </div>
        </div>
    	<div class="layui-form-item">
            <label class="layui-form-label"> 社团号：</label>
            <div class="layui-input-block">
                <input type="text" id="soc_no" required  lay-verify="required" readonly autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"> 社团名：</label>
            <div class="layui-input-block">
                <input type="text" id="soc_name" required  lay-verify="required" readonly="readonly" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"> 社团类别：</label>
            <div class="layui-input-block">
                <input type="text" id="soc_type" required  lay-verify="required" readonly autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">挂靠单位：</label>
            <div class="layui-input-block">
            <input type="text" id="soc_unit" required  lay-verify="required" readonly autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">所在校区：</label>
            <div class="layui-input-block">
            <input type="text" id="soc_locat" required  lay-verify="required" readonly autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">负责人：</label>
            <div class="layui-input-block">
                <input type="text" id="soc_man" required  lay-verify="required" readonly autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">会长电话：</label>
            <div class="layui-input-block">
            <input type="text" id="soc_tele" required  lay-verify="required|number" readonly autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">当前人数：</label>
            <div class="layui-input-block">
            <input type="text" id="soc_count" required  lay-verify="required|number" readonly autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">社团介绍：</label>
            <div class="layui-input-block">
                <textarea id="soc_intro" readonly class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
                <div class="layui-input-block btn-center">
                   <a class="layui-btn" id="iBtn">修改</a>
                </div>
        </div>
    </form>
  </div>
</body>
<!-- 修改社员信息 -->
<form id="partyInfo" class="layui-form bs-hidden fm-in" lay-filter="partyInfo">
      <div class="layui-form-item  bs-hidden">
            <label class="layui-form-label"> 社团标识号：</label>
            <div class="layui-input-block">
                <input type="text" id="soc_markD" name="soc_markD" required  lay-verify="required"  autocomplete="off" class="layui-input" >
            </div>
        </div>
    	<div class="layui-form-item  bs-hidden">
            <label class="layui-form-label"> 社团代号：</label>
            <div class="layui-input-block">
                <input type="text" id="soc_noD" name="soc_noD" required  lay-verify="required"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"> 社团名字：</label>
            <div class="layui-input-block">
                <input type="text" id="soc_nameD"  name="soc_nameD" readonly="readonly" required  lay-verify="required"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"> 社团类别：</label>
            <div class="layui-input-block">
                <input type="text" id="soc_typeD" name="soc_typeD" required  lay-verify="required"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">挂靠单位：</label>
            <div class="layui-input-block">
            <input type="text" id="soc_unitD" name="soc_unitD" required  lay-verify="required"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">所在校区：</label>
            <div class="layui-input-block">
            <input type="text" id="soc_locatD" name="soc_locatD" required  lay-verify="required"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">负责人：</label>
            <div class="layui-input-block">
                <input type="text" id="soc_manD" name="soc_manD" required  lay-verify="required"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">负责人电话：</label>
            <div class="layui-input-block">
            <input type="text" id="soc_teleD" name="soc_teleD" required  lay-verify="required|number"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">当前人数：</label>
            <div class="layui-input-block">
            <input type="text" id="soc_countD" name="soc_countD" readonly required  lay-verify="required|number" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">社团介绍：</label>
            <div class="layui-input-block">
                <textarea id="soc_introD" name="soc_introD" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
                <div class="layui-input-block btn-center">
                    <button class="layui-btn" lay-submit lay-filter="pwd">提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
        </div>
    </form>
<span class="bs-hidden" id="Sid"></span>
<script>

 layui.use(['laydate','form','jquery','layer','table'], function(){
  var laydate = layui.laydate;
  var form = layui.form
  var $ = layui.jquery
  var layer = layui.layer
  var table = layui.table;
  //自定义验证规则
  form.verify({
    //为账号定义的验证添加规则
    
    
  })
  
$.ajax({
  	type:"POST",
  	url:"/user/getManUser",
  	dataType:"json",
  	error:function(){
  		console.log("error!");
  	},
  	success:function(data){
  		console.log(data);
  		$('#Sid').html(data.soc_no);
  	//	alert($('#Sid').text());
  		ajaxNO1();
  	}
  })
  
function ajaxNO1(){
  $.ajax({
	  type:"GET",
	  url:'/manager/serchMySociety',
	  data:{"soc_no":$('#Sid').text()},//等写好登录记得更改
	  error:function(XMLHttpRequest, textStatus, errorThrown){
		  alert(XMLHttpRequest+'    '+textStatus+"    说明服务器返回失败");
	  },
	  dataType:"json",
	  success:function(data){
		  console.log(data);
		  $('#soc_mark').val(data.soc_mark);
		  $('#soc_no').val(data.soc_no);
		  $('#soc_name').val(data.soc_name);
		  $('#soc_type').val(data.soc_type);
		  $('#soc_unit').val(data.soc_unit);
		  $('#soc_locat').val(data.soc_locat);
		  $('#soc_man').val(data.soc_man);
		  $('#soc_tele').val(data.soc_tele);
		  $('#soc_count').val(data.soc_count);
		  $('#soc_intro').val(data.soc_intro);
		  
		  
		  $('#soc_markD').val(data.soc_mark);
		  $('#soc_noD').val(data.soc_no);
		  $('#soc_nameD').val(data.soc_name);
		  $('#soc_typeD').val(data.soc_type);
		  $('#soc_unitD').val(data.soc_unit);
		  $('#soc_locatD').val(data.soc_locat);
		  $('#soc_manD').val(data.soc_man);
		  $('#soc_teleD').val(data.soc_tele);
		  $('#soc_countD').val(data.soc_count);
		  $('#soc_introD').val(data.soc_intro);
	  }
  })

}
//  ajaxNO1();
  $("#iBtn").click(function(){
      layer.open({
          title:'社团信息修改',
          offset: '10px',
          type:1,
          content:$('#partyInfo'),
          area:['800px','650px'],
          
      });
  })
  //监听提交
  form.on('submit(pwd)', function(data){
    console.log(data.field);
    $.ajax({
    	type:"GET",
    	url:"/manager/changeSocietyMessage",
    	data:{
    		soc_mark:data.field.soc_markD,
    		soc_no:data.field.soc_noD,
    		soc_name:data.field.soc_nameD,
    		soc_type:data.field.soc_typeD,
    		soc_unit:data.field.soc_unitD,
    		soc_locat:data.field.soc_locatD,
    		soc_man:data.field.soc_manD,
    		soc_tele:data.field.soc_teleD,
    		soc_count:data.field.soc_countD,
    		soc_intro:data.field.soc_introD
    	},
    	error:function(){
    		alert("error!");
    	},
    	success:function(data){
    		console.log(data);
    		if(data == true){
    			layer.msg('修改成功!',{
    				time:1000
    			},function(){
    				layer.closeAll();
    			});
    			
    			ajaxNO1();
    			return false;
    		}else if(data == false){
    			layer.msg('修改失败!',{
    				time:1000
    			},function(){
    				layer.closeAll();
    			});
    			ajaxNO1();
    			return false;
    		}
    	}	
    })
    
    return false;
  });

})

</script>

</html>

